<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>promise2</title>
</head>

<body>
    <script src="./axios.min.js"></script>
    <script>
        function getData1(id){
            return fetch("https://mock.mengxuegu.com/mock/6673cc1fbe17764121dfc577/ajax/student/"+id).then(res=>res.json())
        }
        function getData2(){
            return fetch("https://mock.mengxuegu.com/mock/6673cc1fbe17764121dfc577/ajax/students/1").then(res=>res.json())
        }
        Promise.race([getData1(1),getData2()]).then(res=>{
            console.log(res);
        })
        // Promise.all([getData1(1),getData1(2)]).then(res=>{
        //     console.log(res);
        // })
        // axios.get('https://mock.mengxuegu.com/mock/6673cc1fbe17764121dfc577/ajax/student/1')
        //     .then(res => {
        //         console.log(res);
        //     })
        // axios.post('https://mock.mengxuegu.com/mock/6673cc1fbe17764121dfc577/ajax/phone', {
        //     headers: {
        //         "Content-Type": "application/x-www-form-urlencoded"
        //     },
        //     body: "phone=13112345678"
        // })
        //     .then(res => {
        //         console.log(res);
        //     })
       


    </script>
</body>

</html>